-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Autotools: Add pkg-config for GMP library #15166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MSTM
Could omit the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me, and this can land in the beta IMHO
Yes, I think removing the DIR argument could be possible and not problematic. In the current implementation (as is in the current master branch, not in this PR) this DIR is not working ok on many *nix installations because gmp is actually installed to a compiler default locations (such as machine includes, library path of /usr/lib/x86_64_linux-gnu etc.) So, if pkg-config doesn't find it it falls back to just checking the default paths (like it does already) and if still not found some sensible error is thrown. I'll recheck and test this a bit to not miss anything. |
Issue with removing the DIR argument
So, I would suggest to go with using optional pkg-config and then resorting to system paths as a fallback. And optionally check the DIR argument here. |
GMP has pkg-config integration since 2019-08-22 (version ~6.2.0). This optionally finds the GMP library using pkg-config or falls back to find library on the system or with the provided configure option argument (--with-gmp=DIR). When using DIR argument, the pkg-config check is silently skipped. When not using DIR argument, the GMP_CFLAGS and GMP_LIBS can be also used to find the GMP library: ./configure --with-gmp \ GMP_CFLAGS=-I/path/to/gmp/include \ GMP_LIBS="-L/path/to/gmp -lgmp"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel we could tell people to set the manual overrides or adjust PKG_CONFIG_PATH
, but this is also fine as it stands.
Yes, PHP started adopting this pkg-config at some point very heavily. But passing the library installation directory isn't something bad or old. If the library follows some minimum standards and has GNU-like installation directory structure it is actually simpler to use than adjusting pkg-config variables. Also, just for example, CMake has |
This can also wait for the next PHP version or perhaps for PHP 8.4 beta otherwise it seems to be working fine.
GMP has pkg-config integration since 2019-08-22 (version ~6.2.0).
This optionally finds the GMP library using pkg-config or falls back to find library on the system or with the provided configure option argument (--with-gmp=DIR).
When using DIR argument, the pkg-config check is silently skipped.
When not using DIR argument, the GMP_CFLAGS and GMP_LIBS can be also used to find the GMP library: